<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/10/28
 * Time: 17:44
 */

namespace App;

use Illuminate\Database\Eloquent\Model;

class Student extends Model
{
    //自定义表
    protected $table = 'student';
    //自定义主键
    protected $primaryKey = 'id';
    //自定义可以批量赋值的字段
    protected $fillable = ['name','age','sex'];
    //自定义不可以批量赋值的字段
    protected $guarded = [];
    //自动添加时间
    public $timestamps = true;
    //改成时间戳
    public function getDateFormat(){
        return time();
    }
    //查出数据是时间戳自动变成时间格式 取消自动设置
    protected function asDateTime($val){
        return $val;
    }

}